﻿namespace DreamBuilder.Common
{
    using DreamBuilder.DictionaryAccess;
    using DreamBuilder.DictionaryAccess.Models;
    using System;

    public static class CResManager
    {
        public static string GetPublicString(string resName, string stringKey)
        {
            string str = "";
            try
            {
                SystemResInfo systemResInfo = DictionaryAccessFacade.GetSystemResInfo("Public/" + resName, stringKey);
                if (systemResInfo != null)
                {
                    return systemResInfo.Desc;
                }
                str = "[" + stringKey + "]";
            }
            catch
            {
                if (string.IsNullOrEmpty(str))
                {
                    str = "[" + stringKey + "]";
                }
            }
            return str;
        }

        public static string GetString(string pageUrl, string stringKey)
        {
            string str = "";
            try
            {
                SystemResInfo systemResInfo = DictionaryAccessFacade.GetSystemResInfo(pageUrl, stringKey);
                if (systemResInfo != null)
                {
                    return systemResInfo.Desc;
                }
                str = "[" + stringKey + "]";
            }
            catch
            {
                if (string.IsNullOrEmpty(str))
                {
                    str = "[" + stringKey + "]";
                }
            }
            return str;
        }
    }
}

